<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增需求状态')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-statuse-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">状态名称：</label>
                    <div class="col-sm-8">
                        <input name="name" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">是否为关闭状态：</label>
                    <div class="col-sm-8">
                        <input name="isClosed" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">是否为默认状态：</label>
                    <div class="col-sm-8">
                        <input name="isDefault" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">状态颜色：</label>
                    <div class="col-sm-8">
						<input name="htmlColor" class="form-control jscolor" type="text" id="htmlColor" data-jscolor="{}" required>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
	<script th:src="@{/ajax/libs/jscolor/jscolor.min.js}"></script>
    <script th:inline="javascript">
        var prefix = ctx + "project/statuse"
        $("#form-statuse-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var formData = $('#form-statuse-add').serializeArray();
                formData.forEach(function(item) {
                    if (item.name === "htmlColor" && item.value.startsWith("#")) {
                        item.value = item.value.substring(1);
                    }
                });
                $.operate.save(prefix + "/add", $.param(formData));
            }
        }
    </script>
</body>
</html>